<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
 
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
 
/**
 * Anjolina Controller for category selection
 */
class AnJoLinAControllerSelectCategories extends JControllerAdmin
{
	/**
	 * Proxy for getModel.
	 * @since	1.6
	 */ 
	public function getModel($name = 'SelectCategories', $prefix = 'AnJoLinAModel') //AnJoLinA
	{
		$model = parent::getModel($name, $prefix, array('ignore_request' => true));
		return $model;
	}
	
/**
	 * Rebuild the nested set tree.
	 *
	 * @return	bool	False on failure or error, true on success.
	 * @since	1.6
	 */
	public function rebuild()
	{
		JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

		$extension = JRequest::getCmd('extension');
		

		// Initialise variables.
		$model = $this->getModel();
		
		$this->setRedirect(JRoute::_('index.php?option=com_anjolina', false));
		
		if ($model->rebuild()) {
			// Rebuild succeeded.
			$this->setMessage(JText::_('COM_ANJOLINA_REBUILD_SUCCESS'));
			return true;
		} else {
			// Rebuild failed.
			$this->setMessage(JText::_('COM_ANJOLINA_REBUILD_FAILURE'));
			return false;
		}
		
	}
	
	
}